package com.xiyoumobile.dengtuo.flowershop;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageButton;
import android.widget.TextView;

import javahtml5.JsDetailActivity;
import javahtml5.JsEternalActivity;

public class EternalActivity extends Activity {

    WebView webView;
    TextView textView;
    ImageButton imageButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_eternal);

        findView();
    }

    private void findView() {

        imageButton = (ImageButton) findViewById(R.id.title_bar_back);
        imageButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                finish();
            }
        });

        textView = (TextView) findViewById(R.id.title);

        //获取传过来的参数
        int id = getIntent().getIntExtra("id", 0);

        webView = (WebView) findViewById(R.id.webView);
        // WebView打开权限
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setSupportZoom(true);

        webView.setWebViewClient(new WebViewClient());
        JsEternalActivity javaSrcipt =
                new JsEternalActivity(EternalActivity.this, webView);
        webView.addJavascriptInterface(javaSrcipt, "native");
        webView.loadUrl("file:///android_asset/eternal.html");
    }
}
